package service

type WChatLoginRequest struct {
	NickName  string `form:"nick_name" binding:"required"`
	WChatId   string `form:"w_chat_id" binding:"required"`
	AvatarUrl string `form:"avatar_url" binding:"required"`
}

func (svc Service) WChatLogin(param *WChatLoginRequest) (int, error) {
	user, err := svc.dao.GetUserWithWChatId(param.NickName, param.WChatId, param.AvatarUrl)
	if err != nil {
		return -1, err
	}

	return user.ID, nil
}
